package com.woniuxy.educationplatform.service.impl;

import com.woniuxy.educationplatform.bean.ProjectBean;
import com.woniuxy.educationplatform.bean.SubjectBean;
import com.woniuxy.educationplatform.mapper.ProjectMapper;
import com.woniuxy.educationplatform.service.IProjectService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
public class ProjectServiceImpl implements IProjectService {

    @Resource
    private ProjectMapper projectMapperImpl;

    @Override
    public List<ProjectBean> findAll() {
        return projectMapperImpl.findAll();
    }

    @Override
    public ProjectBean findById(Long id) {
        return projectMapperImpl.findById(id);
    }

    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public void saveProjectBean(ProjectBean projectBean) {
        projectMapperImpl.saveProjectBean(projectBean);
    }

    @Override
    public Long findMaxId() {
        return projectMapperImpl.findMaxId();
    }

    @Override
    public Long findIdByName(String projName) {
        return projectMapperImpl.findIdByName(projName);
    }


    /* *//**
     * 条件查询 返回的是一个list集合。里面可能存在多个subjectBean,projectName可以用projectBean.name的方式点出来
     * @param projectName
     * @param createTime
     * @return
     *//*
    @Override
    public List<SubjectBean> findByCondition(String projectName, Date createTime) {
        return projectMapperImpl.findOneByCondition(projectName, createTime);
    }*/
}
